package com.jie.demo.mock;

import org.junit.Test;

import java.util.List;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

/**
 * Junit 可以校验值，mockito 可以校验行为
 */
public class VerifyMock {
    @Test
    public void testVerify(){
        // mock creation 创建mock对象
        List mockedList = mock(List.class);

        //using mock object 使用mock对象
        mockedList.add("one");
        mockedList.clear();
        //verification 验证
        verify(mockedList).add("one");
        verify(mockedList).clear();
    }
}
